package com.lcj.ai.config;

import io.modelcontextprotocol.client.McpClient;
import io.modelcontextprotocol.client.McpSyncClient;
import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class McpClientConfig {
    @Bean
    McpSyncClient mcpSyncClient() {
        // 构建一个同步的 MCP 客户端，连接到本地 8081 端口的调度服务
        var mcpClient = McpClient // 改个变量名
                .sync(HttpClientSseClientTransport.builder("http://localhost:8081").build())
                .build();
        mcpClient.initialize(); // 初始化客户端
        return mcpClient;
    }
}
